<?php
class studentaccount extends control
{
    public function __construct()
    {
        parent::__construct();
        $this->app->loadLang('index');
    }
    public function create()
    {
        if(!empty($_POST))
        {
            $this->studentaccount->create();
            if(dao::isError()) die(js::error(dao::getError()) . js::locate('back'));
            die(js::locate(inlink('index')));
        }
        // 获取校区列表
        $this->view->campusList = $this->student->lsCampus();
        $this->display();
    }
    // 学员列表
    public function index($recTotal = 0, $recPerPage = 20, $pageID = 0)
    {
        $this->app->loadClass('pager');
        $pager = new pager($recTotal, $recPerPage, $pageID);
        $this->view->title    = $this->lang->student->index;
        $this->view->students = $this->studentaccount->getList($pager);
        $this->view->pager    = $pager;
        $this->display();
    }
    // 查看账户流水
    public function view($id, $accountype)
    {
        $this->view->studentAccount = $this->studentaccount->getByID($id, $accountType);
        $this->display();
    }

    /**
     * Delete an article.
     *
     * @param  int    $id
     * @access public
     * @return void
     */
    public function delete($id)
    {
        $this->studentaccount->delete($id);
        $this->locate(inlink('index'));
    }
}